package com.vx.vxbug.entities;

import java.util.Calendar;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.vx.vxbug.BugPriority;
import com.vx.vxbug.BugStatus;

@Entity
@Table(name = "bugs")
public class Bug {
	@Id
	@GeneratedValue
	@Column(name = "bug_id")
	private int id;
	private int programId;
	private String programVersionWithBug;
	private String openerUserName;
    private int openerUserId = 0;
	@Enumerated(EnumType.STRING)
	private BugPriority priority;

	@Temporal(value = TemporalType.DATE)
	private Date date;
	@Enumerated(EnumType.STRING)
	private BugStatus status;
	private String programVersionFixed;

	private String bugTitle;
	private String bugInfo;

	public Bug(int programId, String programVersionWithBug, String openerUserName, BugPriority priority, Date date, String bugTitle,
			String bugInfo) {
		super();
		this.programId = programId;
		this.programVersionWithBug = programVersionWithBug;
		this.openerUserName = openerUserName;
		this.priority = priority;
		this.setDate(date);
		this.bugTitle = bugTitle;
		this.bugInfo = bugInfo;
		setStatus(BugStatus.Open);
	}

	public Bug() {
		super();
	}

	public String getBugTitle() {
		return bugTitle;
	}

	public void setBugTitle(String bugTitle) {
		this.bugTitle = bugTitle;
	}

	public String getBugInfo() {
		return bugInfo;
	}

	public void setBugInfo(String bugInfo) {
		this.bugInfo = bugInfo;
	}

	public int getId() {
		return id;
	}

	public int getProgramId() {
		return programId;
	}

	@Override
	public String toString() {
		return "Bug [bugId=" + id + ", programId=" + programId + ", bugTitle=" + bugTitle + "]";
	}

	public String getProgramVersionWithBug() {
		return programVersionWithBug;
	}

	public void setProgramVersionWithBug(String programVersionWithBug) {
		this.programVersionWithBug = programVersionWithBug;
	}

	public String getProgramVersionFixed() {
		return programVersionFixed;
	}

	public void setProgramVersionFixed(String programVersionFixed) {
		this.programVersionFixed = programVersionFixed;
	}

	public BugStatus getStatus() {
		return status;
	}

	public void setStatus(BugStatus status) {
		this.status = status;
	}

	public BugPriority getPriority() {
		return priority;
	}

	public void setPriority(BugPriority priority) {
		this.priority = priority;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void setProgramId(int programId) {
		this.programId = programId;
	}

    public String getOpenerUserName() {
        return openerUserName;
    }

    public void setOpenerUserName(String openerUserName) {
        this.openerUserName = openerUserName;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public int getOpenerUserId() {
        return openerUserId;
    }

    public void setOpenerUserId(int openerUserId) {
        this.openerUserId = openerUserId;
    }
}
